package com.syt.dome.controller;

import com.syt.commer.Result;
import com.syt.dome.service.DepartmentService;
import com.syt.entity.vo.hosp.DepartmentVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags="排班管理")
@RestController
@RequestMapping("/syt/hosp/department")
//@CrossOrigin// 跨域  使用了网关就不需要这个了
public class DepartmenController {

    @Autowired// 排班列表
    private DepartmentService departmentService;


    // 根据医院的编号查询，科室的列表
    @ApiOperation(value = "查询医院所有科室列表")
    @GetMapping("getDeptList/{hoscode}")
    public Result getDeptList(@PathVariable String hoscode) {

        // 树状结构显示
        List<DepartmentVo> list = departmentService.findDeptTree(hoscode);

        System.out.println(list);
        return Result.ok(list);
    }



    //根据医院编号，查询医院所有科室列表
    @ApiOperation(value = "查询医院所有科室列表副本")
    @GetMapping("getDeptLists/{hoscode}")
    public Result getDeptLists(@PathVariable String hoscode) {
        List<DepartmentVo> list = departmentService.findDeptTrees(hoscode);
        return Result.ok(list);
    }


}
